/*
	 * Click event for create button
	 * Creates new value of data being displayed in Modal form
	 * Refreshes data table on successful creation
	 * 
	 * Calls 
	 * refreshMyTable()
	 * 
	 * converter()
	 * <SerializedArray> - Serialized Array of Form Data
	 */
	    $("#changePassword").click(function(){

    	if($('#forgotPasswordForm').valid()) {
		formData = ($('#forgotPasswordForm').serializeArray());
 
		$.ajax({
		    url : 'http://localhost:8080/easyskool/rest/userauthservice/changePasswordDetails',
			type : 'POST',
			async: false,
			data : '{"user":"sumit","whereClause":'+ converter(formData)+ '}',
			dataType : 'json',
			contentType : "application/json; charset=utf-8",
			success : function(data,testStatus,jqXHR) {
				var json = jQuery.parseJSON(jqXHR.responseText);
					if(json.responseMessage == "success"){
						alert("Password Changed");
					} else if(json.responseMessage == "error")
					{
						alert("No record by this Email found or wrong credentials have been entered");
					}
				 
			}
		
	    });
    	}
	});
    